package com.sb.money.entities;

// Generated Dec 2, 2012 10:52:01 PM by Hibernate Tools 3.2.2.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Categorization generated by hbm2java
 */
@Entity
@Table(name = "categorization"
        , catalog = "money")
public class Categorization implements java.io.Serializable {

    private static final long serialVersionUID = 5728791885627705892L;
    private Long categorizationId;
    private Subcategory subcategory;
    private Category category;
    private Set<Item> items = new HashSet<Item>(0);

    public Categorization() {
    }

    public Categorization(Subcategory subcategory, Category category) {
        this.subcategory = subcategory;
        this.category = category;
    }

    public Categorization(Subcategory subcategory, Category category,
            Set<Item> items) {
        this.subcategory = subcategory;
        this.category = category;
        this.items = items;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "CATEGORIZATION_ID", unique = true, nullable = false)
    public Long getCategorizationId() {
        return this.categorizationId;
    }

    public void setCategorizationId(Long categorizationId) {
        this.categorizationId = categorizationId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SUBCATEGORY_ID", nullable = false)
    public Subcategory getSubcategory() {
        return this.subcategory;
    }

    public void setSubcategory(Subcategory subcategory) {
        this.subcategory = subcategory;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CATEGORY_ID", nullable = false)
    public Category getCategory() {
        return this.category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "categorization")
    public Set<Item> getItems() {
        return this.items;
    }

    public void setItems(Set<Item> items) {
        this.items = items;
    }

}
